/*
 * Reservation.cpp
 *
 *  Created on: 23 mars 2012
 *      Author: root
 */

#include "Reservation.h"
#include <fstream>

Reservation::Reservation() {}

Reservation::Reservation(int NombreDeJour,long NumReservation, string NaturePaiment,string DateDebut,string DateRetour,string DateReservation,string NumMatricule,long CIN,string NomAgent,float Prix)
{
	this-> NombreDeJour=NombreDeJour;
	this-> NumReservation=NumReservation;
	this-> NaturePaiment=NaturePaiment;
	this-> DateDebut=DateDebut;
	this-> DateRetour=DateRetour;
	this-> DateReservation=DateReservation;
	this-> NumMatricule=NumMatricule;
	this->CIN=CIN;
	this->NomAgent=NomAgent;
	this ->Prix=Prix;
}
Reservation::Reservation(const Reservation& R)
{
		NumMatricule=R.NumMatricule;
		NombreDeJour=R.NombreDeJour;
		NumReservation=R.NumReservation;
		NaturePaiment=R.NaturePaiment;
		DateDebut=R.DateDebut;
		DateRetour=R.DateRetour;
		DateReservation=R.DateReservation;
		CIN=R.CIN;
		NomAgent=R.NomAgent;
		Prix=R.Prix;
}
Reservation::~Reservation() {}


string Reservation::getNomAgent() const
{
	return NomAgent;
}

void Reservation::setNomAgent(string NomAgent)
{
	this->NomAgent=NomAgent;
}
//
string Reservation::getNumMatricule() const
{
	return NumMatricule;
}

void Reservation::setNumMatricule(string NumMatricule)
{
	this->NumMatricule=NumMatricule;
}
//
string Reservation::getDateDebut() const
{
    return DateDebut;
}

void  Reservation::setDateDebut(string DateDebut)
{
	this ->DateDebut = DateDebut;
}
//
string Reservation::getDateReservation() const
{
    return DateReservation;
}

void Reservation::setDateReservation(string dateReservation)
{
	this ->DateReservation = dateReservation;
}
//
string Reservation::getDateRetour() const
{
    return DateRetour;
}

void Reservation::setDateRetour(string dateRetour)
{
	this ->DateRetour = dateRetour;
}
//
string Reservation::getNaturePaiment() const
{
    return NaturePaiment;
}

void Reservation::setNaturePaiment(string naturePaiment)
{
	this ->NaturePaiment = naturePaiment;
}
//
int Reservation::getNombreDeJour() const
{
    return NombreDeJour;
}

void Reservation::setNombreDeJour(int nombreDeJour)
{
   this ->NombreDeJour = nombreDeJour;
}
//
long Reservation::getCIN() const
{
    return CIN;
}

void Reservation::setCIN(long CIN)
{
   this ->CIN = CIN;
}
//

long Reservation::getNumReservation() const
{
    return NumReservation;
}

void Reservation::setNumReservation(long numReservation)
{
	this ->NumReservation = numReservation;
}
//
float Reservation::getPrix()const
{
	return Prix;
}
void Reservation::setPrix(float Prix)
{
	this->Prix=Prix;
}
//
float Reservation::PrixAPayer(int NbrJour)const
{float X;

	if (NbrJour<7)
		{
			X=NbrJour*65.000;
		}

		else if ((NbrJour>=7)&&(NbrJour<30))
			{
				 X=NbrJour*50.500;
			}
		else
			{
				 X=NbrJour*40.500;
			}


	return X;
}


ifstream& operator>>(ifstream& in,Reservation& R)
{
in>>R.NombreDeJour;
in>>R.CIN;
in>>R.NumMatricule;
in>>R.NumReservation;
in>>R.NaturePaiment;
in>>R.DateDebut;
in>>R.DateRetour;
in>>R.DateReservation;
in>>R.NomAgent;
in>>R.Prix;
return in;
}
ofstream& operator<<(ofstream& out,const Reservation& R)
{
out<<R.getNombreDeJour()<<R.getCIN()<<R.getNumMatricule()<<R.getNumReservation()<<R.getNaturePaiment()<<R.getDateDebut()<<R.getDateRetour()<<R.getDateReservation()<<R.getNomAgent()<<R.getPrix();
return out;
}
